using System;
using System.Collections.Generic;
using CoreMobile.cmd;
using Microsoft.WindowsMobile.Status;

namespace TestingMobileNet.log
{
    public class TMobileNetData : IParameter
    {

        //public static SystemState status = new SystemState();

        public static List<TMobileNetData> generateSequenciableData(int max)
        {
            var ds = new List<TMobileNetData>(max);

            for (int i = 1; i <= max; i++)
            {
                ds.Add(new TMobileNetData(""+i));
            }

            
            return ds;
        }

        private DateTime? timestamp;
        private long deltaTime;
        private string id;
        //private int networkQuality;
        //private string networkStatus;

        public TMobileNetData(string msg)
        {
            this.id = msg;
            //timestamp = null;
        }


        public DateTime Timestamp
        {
            get
            {
                if (timestamp == null) timestamp = DateTime.Now;
                return timestamp.Value;
            }
            set { timestamp = value; }
        }

        public long DeltaTime
        {
            get { return deltaTime; }
            set { deltaTime = value; }
        }

        public string Id
        {
            get { return id; }
            set { id = value; }
        }

        public int NetworkQuality
        {
            get
            {

               return SystemState.PhoneSignalStrength;
            }
           // set { networkQuality = value; }
        }

        public string NetworkStatus
        {
            get
            {
                return "cellularDescp:" + SystemState.ConnectionsCellularDescriptions+"+"
                    + "netDescp:" + SystemState.ConnectionsNetworkDescriptions+"+"
                    + "gprs:" + SystemState.PhoneGprsCoverage;
            }
          //  set { networkStatus = value; }
        }

        public string[] info()
        {
            return new[]
                       {
                           this.Id + "" ,
                           this.Timestamp.ToString("yyyy-MM-dd HH:mm:ss") ,
                           this.NetworkQuality + "",
                           this.NetworkStatus
                       };
        }
    }
}